using System.Collections.Generic;
using Core.Domain.Bases;

namespace Core.Domain.Entities
{
  ///<summary>Record of one election</summary>
  public class BallotSet : EntityBaseWithId
  {
    ///<summary></summary>
    public BallotSet()
    {
      Ballots = new List<Ballot>();
    }

    ///<summary></summary>
    public virtual Election Election { get; set; }

    ///<summary></summary>
    public virtual IList<Ballot> Ballots { get; set; }

  }

  public static partial class Adders
  {
    ///<summary>Add a Ballot to this BallotSet</summary>
    ///<param name="ballotSet"></param>
    ///<param name="ballot"></param>
    public static BallotSet Add(this BallotSet ballotSet, Ballot ballot)
    {
      ballot.InBallotSet = ballotSet;
      ballotSet.Ballots.Add(ballot);
      return ballotSet;
    }
  }
}